Method and apparatus for coding video and method and apparatus for decoding video accompanied with arithmetic coding

ABSTRACT

A method of decoding a video through symbol decoding includes parsing symbols of image blocks from a received bitstream; classifying a current symbol into a prefix bit string and a suffix bit string based on a threshold value determined according to a size of a current block; performing arithmetic decoding of the prefix bit string and the suffix bit string by using respective arithmetic decoding methods determined for each of the prefix bit string and the suffix bit string; performing inverse binarization of the prefix bit string and the suffix bit string by using respective binarization methods determined for each of the prefix bit string and the suffix bit string; and restoring the image blocks by performing an inverse transformation operation and a prediction operation on the current block by using the current symbol restored through the arithmetic decoding and the inverse binarization.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a Continuation of U.S. application Ser. No.15/584,523 filed on May 2, 2017, in the U.S. Patent and TrademarkOffice, which is a Continuation of U.S. application Ser. No. 14/635,725filed on Mar. 2, 2015, in the U.S. Patent and Trademark Office, now U.S.Pat. No. 9,668,001, issued on May 30, 2017, which is a Continuation ofU.S. application Ser. No. 14/130,052 filed on Apr. 7, 2014, in the U.S.Patent and Trademark Office, now U.S. Pat. No. 9,565,455, issued on Feb.7, 2017, which is a National Stage Entry of PCT/KR2012/005087 filed onJun. 27, 2012, which claims the benefit of U.S. provisional patentapplication No. 61/502,038 filed on Jun. 28, 2011, in the U.S. Patentand Trademark Office, the entire disclosures of which are hereinincorporated by reference in their entireties.

TECHNICAL FIELD

Exemplary embodiments relate to video encoding and video decodinginvolving arithmetic encoding and arithmetic decoding, respectively.

BACKGROUND OF THE RELATED ART

As hardware for reproducing and storing high resolution or high qualityvideo content is being developed and supplied, a need for a video codecfor effectively encoding or decoding the high resolution or high qualityvideo content is increasing. In a conventional video codec, a video isencoded according to a limited encoding method based on a macroblockhaving a predetermined size.

Image data of a spatial domain is converted to coefficients of afrequency region by using a frequency conversion method. A video codecencodes frequency coefficients in units of blocks by dividing an imageinto a plurality of blocks having a predetermined size and performingdiscrete cosine transformation (DCT) conversion for rapid operation offrequency conversion. The coefficients of the frequency region areeasily compressed compared to the image data of the spatial domain. Inparticular, a pixel value of an image in the spatial domain isrepresented as a prediction error, and thus, if frequency conversion isperformed on the prediction error, a large amount of data may beconverted to 0. A video codec converts data that is continuously andrepeatedly generated into smaller data to reduce an amount of data.

SUMMARY

Exemplary embodiments provide a method and apparatus for performingarithmetic encoding and arithmetic decoding of a video by classifying asymbol into prefix and suffix bit strings.

According to an aspect of an exemplary embodiment, there is provided amethod of decoding a video through symbol decoding, the methodincluding: parsing symbols of image blocks from a received bitstream;classifying a current symbol into a prefix bit string and a suffix bitstring based on a threshold value determined according to a size of acurrent block; performing arithmetic decoding of the prefix bit stringand the suffix bit string by using respective arithmetic decodingmethods determined for each of the prefix bit string and the suffix bitstring; performing inverse binarization of the prefix bit string and thesuffix bit string by using respective binarization methods determinedfor each of the prefix bit string and the suffix bit string; andrestoring the image blocks by performing an inverse transformationoperation and a prediction operation on the current block by using thecurrent symbol restored through the arithmetic decoding and the inversebinarization.

Efficiency of a symbol encoding/decoding process is improved byperforming a binarization method having a relatively small amount ofoperation burden on the suffix region or the suffix bit string or byomitting the context modeling during the context-based arithmeticencoding/decoding for symbol encoding/decoding.

The performing of the inverse binarization may include restoring aprefix region and a suffix region of the current symbol by performingthe inverse binarization according to the respective binarizationmethods determined for each of the prefix bit string and the suffix bitstring.

The performing of the arithmetic decoding may include: performingarithmetic decoding for determining context modeling on the prefix bitstring according to locations of bits; and performing arithmeticdecoding for omitting the context modeling on the suffix bit string in abypass mode.

The performing of the arithmetic decoding may include performing thearithmetic decoding by using a context of a predetermined index that ispreviously allocated to locations of bits of the prefix bit string, whenthe symbol is final coefficient position information of a transformationcoefficient.

The current symbol may include at least one of an intra prediction modeand final coefficient position information of the current block.

The binarization method further may include at least one selected fromthe group consisting of unary binarization, truncated unarybinarization, exponential golomb binarization, and fixed lengthbinarization.

According to another aspect of an exemplary embodiment, there isprovided a method of encoding a video through symbol encoding, themethod including: generating symbols by performing a predictionoperation and a transformation operation on image blocks; classifying acurrent symbol into a prefix region and a suffix region based on athreshold value determined according to a size of a current block;generating a prefix bit string and a suffix bit string by usingrespective binarization methods determined for each of the prefix regionand the suffix region; performing symbol encoding of the prefix bitstring and the suffix bit string by using respective arithmetic encodingmethods determined for each of the prefix bit string and the suffix bitstring; and outputting bit strings generated through the symbol encodingin the form of bitstreams.

The performing of the symbol encoding may include: performing the symbolencoding on the prefix bit string by using an arithmetic encoding methodfor performing context modeling according to locations of bits; andperforming the symbol encoding on the suffix bit string by using anarithmetic encoding method for omitting the context modeling in a bypassmode.

The performing of the symbol encoding may include performing thearithmetic encoding by using a context of a predetermined index that ispreviously allocated to locations of bits of the prefix bit string, whenthe symbol is final coefficient position information of a transformationcoefficient.

The current symbol may include at least one of an intra prediction modeand final coefficient position information of the current block.

The binarization method may further include at least one selected fromthe group consisting of unary binarization, truncated unarybinarization, exponential golomb binarization, and fixed lengthbinarization.

According to another aspect of an exemplary embodiment, there isprovided an apparatus configured to decode a video through symboldecoding, the apparatus including: a parser configured to parse symbolsof image blocks from a received bitstream; a symbol decoder configuredto classify a current symbol into a prefix bit string and a suffix bitstring based on a threshold value determined according to a size of acurrent block, and to perform arithmetic decoding of the prefix bitstring and the suffix bit string by using respective arithmetic decodingmethods determined for each of the prefix bit string and the suffix bitstring, and to perform inverse binarization of the prefix bit string andthe suffix bit string by using respective binarization methodsdetermined for each of the prefix bit string and the suffix bit string;and an image restorer configured to restore the image blocks byperforming an inverse transformation operation and a predictionoperation on the current block by using the current symbol restoredthrough the arithmetic decoding and the inverse binarization.

According to another aspect of an exemplary embodiment, there isprovided an apparatus configured to encode a video through symbolencoding, the apparatus including: an image encoder configured togenerate symbols by performing prediction and transformation on imageblocks; a symbol encoder configured to classify a current symbol into aprefix region and a suffix region based on a threshold value determinedaccording to a size of a current block, and to generate a prefix bitstring and a suffix bit string by using respective binarization methodsdetermined for each of the prefix region and the suffix region, and toperform symbol encoding of the prefix bit string and the suffix bitstring by using arithmetic encoding methods determined for each of theprefix bit string and the suffix bit string; and a bitstream outputterconfigured to output bit strings generated through the symbol encodingin the form of bitstreams.

According to another aspect of an exemplary embodiment, there isprovided a non-transitory computer readable recording medium havingembodied thereon a computer program for executing the method of decodinga video through symbol decoding.

According to another aspect of an exemplary embodiment, there isprovided a non-transitory computer readable recording medium havingembodied thereon a computer program for executing the method of encodinga video through symbol encoding.

BRIEF DESCRIPTION OF DRAWINGS

FIG. 1 is a block diagram of a video encoding apparatus, according to anexemplary embodiment;

FIG. 2 is a block diagram of a video decoding apparatus, according to anexemplary embodiment of the present invention;

FIGS. 3 and 4 are diagrams for describing arithmetic encoding byclassifying a symbol into a prefix bit string and a suffix bit stringaccording to a predetermined threshold value, according to an exemplaryembodiment;

FIG. 5 is a flowchart for describing a video encoding method, accordingto an exemplary embodiment;

FIG. 6 is a flowchart for describing a video decoding method, accordingto an exemplary embodiment;

FIG. 7 is a block diagram of a video encoding apparatus based on codingunits having a tree structure, according to an exemplary embodiment;

FIG. 8 is a block diagram of a video decoding apparatus based on acoding unit having a tree structure, according to an exemplaryembodiment;

FIG. 9 is a conceptual diagram of coding units, according to anexemplary embodiment;

FIG. 10 is a block diagram of an image encoder based on coding units,according to an exemplary embodiment;

FIG. 11 is a block diagram of an image decoder based on coding units,according to an exemplary embodiment;

FIG. 12 is a diagram showing coding units according to depths andpartitions, according to an exemplary embodiment;

FIG. 13 is a diagram for describing a relationship between a coding unitand transformation units, according to an exemplary embodiment;

FIG. 14 is a diagram for describing encoding information of coding unitsaccording to depths, according to an exemplary embodiment;

FIG. 15 is a diagram showing coding units according to depths, accordingto an exemplary embodiment;

FIGS. 16 to 18 are diagrams for describing a relationship between codingunits, prediction units, and transformation units, according to anexemplary embodiment; and

FIG. 19 is a diagram for describing a relationship between a codingunit, a prediction unit, and a transformation unit according to encodingmode information of Table 1.

DETAILED DESCRIPTION OF EXEMPLARY EMBODIMENTS

Hereinafter, the exemplary embodiments will be described more fully withreference to the accompanying drawings, in which exemplary embodimentsare shown. Expressions such as “at least one of,” when preceding a listof elements, modify the entire list of elements and do not modify theindividual elements of the list.

A video encoding method involving arithmetic encoding and a videodecoding method involving arithmetic decoding according to an exemplaryembodiment will be described with reference to FIGS. 1 to 6. Also, avideo encoding method involving arithmetic encoding and a video decodingmethod involving arithmetic decoding based on coding units having a treestructure according to an exemplary embodiment will be described withreference to FIGS. 7 to 19. Hereinafter, an ‘image’ may refer to a stillimage of a video or a movie, that is, a video itself.

Hereinafter, a video encoding method and a video decoding method basedon a prediction method in an intra prediction mode, according to anexemplary embodiment, will be described with reference to FIGS. 1 to 6.

FIG. 1 is a block diagram of a video encoding apparatus 10, according toan exemplary embodiment.

The video encoding apparatus 10 may encode video data of a spatialdomain through intra prediction/inter prediction, transformation,quantization, and symbol encoding. Hereinafter, operations occurringwhen the video encoding apparatus 10 encodes symbols generated by theintra prediction/inter prediction, the transformation, and thequantization through arithmetic encoding will be described in detail.

The video encoding apparatus 10 includes an image encoder 12, a symbolencoder 14, and a bitstream output unit 16 (e.g., bitstream outputter).

The video encoding apparatus 10 may split image data of a video into aplurality of data units and encode the image data according to the dataunits. The data unit may have a square shape or a rectangular shape, ormay be an arbitrary geometric shape, but the data unit is not limited toa data unit having a predetermined size. According to the video encodingmethod based on the coding units having a tree structure, a data unitmay be a maximum coding unit, a coding unit, a prediction unit, atransformation unit, or the like. An example where an arithmeticencoding/decoding method according to an exemplary embodiment is used inthe video encoding/decoding method based on the coding units having atree structure will be described with reference to FIGS. 7 to 19.

For convenience of description, a video encoding method for a ‘block’which is a kind of data unit will be described in detail. However, thevideo encoding method according to various exemplary embodiments is notlimited to the video encoding method for the ‘block’, and may be usedfor various data units.

The image encoder 12 performs operations, such as intra prediction andinter prediction, transformation, or quantization, on image blocks togenerate symbols.

The symbol encoder 14 classifies a current symbol into a prefix regionand a suffix region based on a threshold value determined according to asize of a current block to encode the current symbol from among thesymbols generated according to the blocks. The symbol encoder 14 maydetermine the threshold value for classifying the current symbol intothe prefix region and the suffix region based on at least one of a widthand a height of the current block.

The symbol encoder 14 may determine a symbol encoding method for each ofthe prefix region and the suffix region and encode each of the prefixregion and the suffix region according to the symbol encoding method.

Symbol encoding may be divided into a binarization process fortransforming a symbol into bit strings and an arithmetic encodingprocess for performing context-based arithmetic encoding on the bitstrings. The symbol encoder 14 may determine a binarization method foreach of the prefix region and the suffix region of the symbol andperform binarization on each of the prefix region and the suffix regionaccording to the binarization method. A prefix bit string and a suffixbit string may be generated from the prefix region and the suffixregion, respectively.

Alternatively, the symbol encoder 14 may determine an arithmeticencoding method for each of the prefix bit string and the suffix bitstring of the symbol and perform arithmetic encoding on each of theprefix bit string and the suffix bit string according to the arithmeticencoding method.

Also, the symbol encoder 14 may determine a binarization method for eachof the prefix region and the suffix region of the symbol and performbinarization on each of the prefix region and the suffix regionaccording to the binarization method, and may determine an arithmeticencoding method for each of the prefix bit string and the suffix bitstring of the symbol and perform arithmetic encoding on the prefix bitstring and the suffix bit string according to the arithmetic encodingmethod.

The symbol encoder 14 according to an exemplary embodiment may determinea binarization method for each of the prefix region and the suffixregion. The binarization methods determined for the prefix region andthe suffix region may be different from each other.

The symbol encoder 14 may determine an arithmetic encoding method foreach of the prefix bit string and the suffix bit string. The arithmeticencoding methods determined for the prefix bit string and the suffix bitstring may be different from each other.

Accordingly, the symbol encoder 14 may binarize the prefix region andthe suffix region by using different methods only in a binarizationprocess of a symbol decoding process, or may encode the prefix bitstring and the suffix bit string by using different methods only in anarithmetic encoding process. Also, the symbol encoder 14 may encode theprefix region (prefix bit string) and the suffix region (suffix bitstring) by using different methods in both the binarization andarithmetic encoding processes.

The selected binarization method may be at least one of generalbinarization, unary binarization, truncated unary binarization,exponential golomb binarization, and fixed length binarization methods.

The symbol encoder 14 may perform symbol encoding by performingarithmetic encoding for performing context modeling on the prefix bitstring according to locations of bits and by performing arithmeticencoding for omitting context modeling on the suffix bit string in abypass mode.

The symbol encoder 14 may individually perform the symbol encoding onthe prefix region and the suffix region with respect to symbolsincluding at least one of an intra prediction mode and final coefficientposition information of a transformation coefficient.

The symbol encoder 14 may also perform the arithmetic encoding by usinga context of a predetermined index that is previously allocated to theprefix bit string. For example, the symbol encoder 14 may performarithmetic encoding by using a context of a predetermined index that ispreviously allocated to each location of the bits of the prefix bitstring when the symbol is final coefficient position information of thetransformation coefficient.

The bitstream output unit 16 outputs bit strings generated through thesymbol encoding in the form of bitstreams.

The video encoding apparatus 10 may perform arithmetic encoding onsymbols of blocks of a video and output the symbols.

The video encoding apparatus 10 may include a central processor (notshown) for controlling each of the image encoder 12, the symbol encoder14, and the bitstream output unit 16. Alternatively, the image encoder12, the symbol encoder 14, and the bitstream output unit 16 may beoperated by processors (not shown) respectively installed therein, andthe entire video encoding apparatus 10 may be operated by systematicallyoperating the processors (not shown). Alternatively, the image encoder12, the symbol encoder 14, and the bitstream output unit 16 may becontrolled by an external processor (not shown) of the video encodingapparatus 10.

The video encoding apparatus 10 may include at least one data storageunit (not shown) for storing data that is input/output to/from the imageencoder 12, the symbol encoder 14, and the bitstream output unit 16. Thevideo encoding apparatus 10 may include a memory controller (not shown)for controlling input/output of data stored in the data storage unit(not shown).

The video encoding apparatus 10 is operated by being linked with aninternal video encoding processor or an external video encodingprocessor to perform video encoding including prediction andtransformation, thereby outputting a result of the video encoding. Theinternal video encoding processor of the video encoding apparatus 10 mayperform a basic video encoding operation not only by using a separateprocessor, but also by including a video encoding processing module inthe video encoding apparatus 10, a central operating apparatus, or agraphic operating apparatus.

FIG. 2 is a block diagram of a video decoding apparatus 20, according toan exemplary embodiment.

The video decoding apparatus 20 may decode the video data encoded by thevideo encoding apparatus 10 through parsing, symbol decoding, inversequantization, inverse transformation, intra prediction/motioncompensation, etc. and restore the video data close to the originalvideo data of the spatial domain. Hereinafter, a process in which thevideo decoding apparatus 20 performs arithmetic decoding on the parsedsymbols from a bitstream to restore the symbols will be described.

The video decoding apparatus 20 includes a parser 22, a symbol decoder24, and an image restoring unit 26 (e.g., image restorer).

The video decoding apparatus 20 may receive a bitstream includingencoded data of a video. The parser 22 may parse symbols of image blocksfrom the bitstream.

The parser 22 may parse the symbols encoded through arithmetic encodingwith respect to the blocks of the video from the bitstream.

The parser 22 may parse symbols including an intra prediction mode ofthe block of the video, final coefficient position information of atransformation coefficient, etc. from the received bitstream.

The symbol decoder 24 determines a threshold value for classifying acurrent symbol into a prefix bit string and a suffix bit string. Thesymbol decoder 24 may determine the threshold value for classifying thecurrent symbol into the prefix bit string and the suffix bit stringbased on a size of a current block, that is, at least one of a width anda height of the current block. The symbol decoder 24 determines anarithmetic decoding method for each of the prefix bit string and thesuffix bit string. The symbol decoder 24 performs symbol decoding byusing the arithmetic decoding method determined for each of the prefixbit string and the suffix bit string.

The arithmetic decoding methods determined for the prefix bit string andthe suffix bit string may be different from each other.

The symbol decoder 24 may determine a binarization method for each ofthe prefix bit string and the suffix bit string of the symbol.Accordingly, the symbol decoder 24 may perform inverse binarization onthe prefix bit string of the symbol by using the binarization method.The binarization methods determined for the prefix bit string and thesuffix bit string may be different from each other.

Also, the symbol decoder 24 may perform arithmetic decoding by using thearithmetic decoding method determined for each of the prefix bit stringand the suffix bit string of the symbol, and may perform inversebinarization by using the binarization method determined for each of theprefix bit string and the suffix bit string generated through thearithmetic decoding.

Accordingly, the symbol decoder 24 may decode the prefix bit string andthe suffix bit string by using different methods only in an arithmeticdecoding process of a symbol decoding process, or may perform inversebinarization by using different methods only in an inverse binarizationprocess. Also, the symbol decoder 24 may decode the prefix bit stringand the suffix bit string by using different methods in both thearithmetic decoding and inverse binarization processes.

The binarization method determined for each of the prefix bit string andthe suffix bit string of the symbol may not only be a generalbinarization method, but may also be at least one of unary binarization,truncated unary binarization, exponential golomb binarization, and fixedlength binarization methods.

The symbol decoder 24 may perform arithmetic decoding for performingcontext modeling on the prefix bit string according to locations ofbits. The symbol decoder 24 may use an arithmetic decoding method foromitting context modeling on the suffix bit string in a bypass mode.Accordingly, the symbol decoder 24 may perform symbol decoding throughthe arithmetic decoding performed on each of the prefix bit string andthe suffix bit string of the symbol.

The symbol decoder 24 may perform the arithmetic decoding on the prefixbit string and the suffix bit string of symbols including at least oneof an intra prediction mode and final coefficient position informationof a transformation coefficient.

The symbol decoder 24 may perform arithmetic decoding by using a contextof a predetermined index that is previously allocated according tolocations of the bits of the prefix bit string when the symbol isinformation about the final coefficient position of the transformationcoefficient.

The image restoring unit 26 may restore a prefix region and a suffixregion of a symbol by performing the arithmetic decoding and the inversebinarization on each of the prefix bit string and the suffix bit string.The image restoring unit 26 may restore the symbol by synthesizing theprefix region and the suffix region of the symbol.

The image restoring unit 26 performs inverse transformation andprediction on the current block by using the current symbol restoredthrough the arithmetic decoding and the inverse binarization. The imagerestoring unit 26 may restore image blocks by performing operations,such as inverse quantization, inverse transformation, or intraprediction/motion compensation, by using the corresponding symbols foreach of the image blocks.

The video decoding apparatus 20 according to an exemplary embodiment mayinclude a central processor (not shown) for controlling each of theparser 22, the symbol decoder 24, and the image restoring unit 26.Alternatively, the parser 22, the symbol decoder 24, and the imagerestoring unit 26 may be operated by processors (not shown) respectivelyinstalled therein, and the entire video decoding apparatus 20 may beoperated by systematically operating the processors (not shown).Alternatively, the parser 22, the symbol decoder 24, and the imagerestoring unit 26 may be controlled by an external processor (not shown)of the video decoding apparatus 20.

The video decoding apparatus 20 may include at least one data storageunit (not shown) for storing data that is input and output to and fromthe parser 22, the symbol decoder 24, and the image restoring unit 26.The video decoding apparatus 20 may include a memory controller (notshown) for controlling input/output of data stored in the data storageunit (not shown).

The video decoding apparatus 20 is operated by being linked with aninternal video decoding processor or an external video decodingprocessor to perform video decoding including inverse transformation.The internal video decoding processor of the video decoding apparatus 20may perform a basic video decoding operation not only by using aseparate processor, but also by including a video decoding processingmodule in the video decoding apparatus 20, a central operatingapparatus, or a graphic operating apparatus.

Context-based adaptive binary arithmetic coding (CABAC) is widely usedas an arithmetic encoding and decoding method based on a context forsymbol encoding and decoding. According to the context-based arithmeticencoding and decoding, each bit of a symbol bit string may be a bin of acontext, and a location of each bit may be mapped to a bin index. Alength of the bit string, that is, a length of the bin, may varyaccording to a size of a symbol value. Context modeling for determininga context of a symbol is required to perform the context-basedarithmetic encoding and decoding. The context is renewed according tolocations of bits of the symbol bit string, that is, in each bin index,to perform the context modeling, and thus a complicated operationprocess is required.

According to the video encoding apparatus 10 and the video decodingapparatus 20 described with reference to FIGS. 1 and 2, the symbol isclassified into the prefix region and the suffix region, and arelatively simple binarization method may be used for the suffix regioncompared to the prefix region. Also, the arithmetic encoding anddecoding through the context modeling is performed on the prefix bitstring, and the context modeling is not performed on the suffix bitstring, and thus a burden of an operation amount for the context-basedarithmetic encoding and decoding may be reduced. Accordingly, the videoencoding apparatus 10 and the video decoding apparatus 20 may improveefficiency of a symbol encoding and decoding process by performing abinarization method having a relatively small amount of operation burdenon the suffix region or the suffix bit string or by omitting the contextmodeling during the context-based arithmetic encoding and decoding forsymbol encoding and decoding.

Hereinafter, various exemplary embodiments for arithmetic encoding thatmay be performed by the video encoding apparatus 10 and the videodecoding apparatus 20 will be described.

FIGS. 3 and 4 are diagrams for describing arithmetic encoding byclassifying a symbol into a prefix bit string and a suffix bit stringaccording to a predetermined threshold value, according to an exemplaryembodiment.

Referring to FIG. 3, a process of performing symbol encoding, accordingto an exemplary embodiment, on final coefficient position information ofa symbol will be described in detail. The final coefficient positioninformation is a symbol representing a location of a final coefficient,not 0, from among transformation coefficients of a block. Since a sizeof the block is defined as a width and a height, the final coefficientposition information may be represented by two-dimensional coordinates,that is, an x-coordinate in a width direction and a y-coordinate in aheight direction. For convenience of description, FIG. 3 shows a casewhere symbol encoding is performed on the x-coordinate in the widthdirection from among the final coefficient position information when awidth of a block is w.

A range of the x-coordinate of the final coefficient positioninformation is within the width of the block, and thus the x-coordinateof the final coefficient position information is equal to or greaterthan 0 and equal to or less than w−1. For the arithmetic encoding of thesymbol, the symbol may be classified into a prefix region and a suffixregion based on a predetermined threshold value th. Thus, the arithmeticencoding may be performed on the prefix bit string in which the prefixregion is binarized, based on the context determined through the contextmodeling. Also, the arithmetic encoding may be performed on the suffixbit string in which the suffix region is binarized, in a bypass mode inwhich the context modeling is omitted.

Here, the threshold value th for classifying the symbol into the prefixregion and the suffix region may be determined based on the width w ofthe block. For example, the threshold value th may be determined to be(w/2)−1 to divide the bit string by two (threshold value determinationformula 1, shown below). Alternatively, the width w of the blockgenerally has a square of 2, and thus the threshold value th may bedetermined based on a log value of the width w (threshold valuedetermination formula 2, shown below).th=(w/2)−1;  <threshold value determination formula 1>th=(log 2w<<1)−1;  <threshold value determination formula 2>

In FIG. 3, according to the threshold value determination formula 1,when the width w of the block is 8, the formula outputs threshold valueth=(8/2)−1=3. Thus, in the x-coordinate of the final coefficientposition information, 3 may be classified as the prefix region, and therest of values other than 3 may be classified as the suffix region. Theprefix region and the suffix region may be binarized according to thebinarization method determined for each of the prefix region and thesuffix region.

When an x-coordinate N of current final coefficient position informationis 5, the x-coordinate of the final coefficient position information maybe classified as N=th+2=3+2. In other words, in the x-coordinate of thefinal coefficient position information, 3 may be classified as theprefix region, and 2 may be classified as the suffix region.

According to an exemplary embodiment, the prefix region and the suffixregion may be binarized according to different binarization methodsdetermined for the prefix region and the suffix region, respectively.For example, the prefix region may be binarized according to a unarybinarization method, and the suffix region may be binarized according toa general binarization method.

Accordingly, after 3 is binarized according to the unary binarizationmethod, a prefix bit string 32 ‘0001’ may be generated from the prefixregion, and after 2 is binarized according to the general binarizationmethod, a suffix bit string 34 ‘010’ may be generated from the suffixregion.

Also, context-based arithmetic encoding may be performed on the prefixbit string 32 ‘0001’ through context modeling. Thus, a context index maybe determined for each bin of the prefix bit string 32 ‘0001’.

Arithmetic encoding may be performed on the suffix bit string 34 ‘010’in a bypass mode without performing context modeling. The arithmeticencoding may be performed without performing the context modelingassuming that in the bypass mode each bin has a context of an equalprobability state, that is, the context of 50%.

Accordingly, the context-based arithmetic encoding may be performed oneach of the prefix bit string 32 ‘0001’ and the suffix bit string 34‘010’ to complete the symbol encoding with respect to the x-coordinate Nof the current final coefficient position information.

Although the exemplary embodiment in which the symbol encoding isperformed via the binarization and the arithmetic encoding has beendescribed, symbol decoding may be performed in the same manner. In otherwords, a parsed symbol bit string may be classified into a prefix bitstring and a suffix bit string based on the width w of the block, thearithmetic decoding may be performed on the prefix bit string 32 throughthe context modeling, and the arithmetic decoding may be performed onthe suffix bit string 34 without performing the context modeling.Inverse binarization may be performed on the prefix bit string 32 afterthe arithmetic decoding by using the unary binarization method, and theprefix region may be restored. Also, the inverse binarization may beperformed on the suffix bit string 34 after the arithmetic encoding byusing the general binarization method, and thus the suffix region may berestored. The symbol may be restored by synthesizing the restored prefixregion and suffix region.

Although the exemplary embodiment in which the unary binarization methodis used for the prefix region (prefix bit string) and the generalbinarization method is used for the suffix region (suffix bit string)has been described, the binarization method is not limited thereto.Alternatively, for example, a truncated unary binarization method may beused for the prefix region (prefix bit string), and a fixed lengthbinarization method may be used for the suffix region (suffix bitstring).

Although only the exemplary embodiment regarding the final coefficientposition information in a width direction of the block has beendescribed, an exemplary embodiment regarding a final coefficientposition information in a height direction of the block may also beused.

Also, there is no need to perform context modeling on the suffix bitstring for performing the arithmetic encoding by using a context havinga fixed probability, but there may be a need to perform variable contextmodeling on the prefix bit string. The context modeling to be performedon the prefix bit string may be determined according to a size of theblock.

<Context Mapping Table> Block Size Bin Index No. of Selected Context 4 ×4 0, 1, 2, 2 8 × 8 3, 4, 5, 5 16 × 16 6, 7, 8, 9, 10, 10, 11,11 32 × 3212, 13, 14, 15, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18

In the context mapping table, a location of each number corresponds tothe bin index of the prefix bit string, and the number denotes a contextindex to be used in a location of the corresponding bit. For convenienceof description, for example, in a 4×4 block, the prefix bit string iscomprised of a total of four bits, and when k is 0, 1, 2, and 3according to the context mapping table, the context indexes 0, 1, 2, and2 are determined for a k-th bin index, and thus arithmetic encodingbased on the context modeling may be performed.

FIG. 4 shows an exemplary embodiment in which an intra prediction modeincludes a luma intra mode and a chroma intra mode indicating an intraprediction direction of a luma block and a chroma block, respectively.When the intra prediction mode is 6, a symbol bit string 40 ‘0000001’ isgenerated according to a unary binarization method. In this case,arithmetic encoding may be performed on a first bit 41 ‘0’ of the symbolbit string 40 of the intra prediction mode, through context modeling,and arithmetic encoding may be performed on the rest of bits 45 ‘000001’of the symbol bit string 40, in a bypass mode. In other words, the firstbit 41 of the symbol bit string 40 corresponds to a prefix bit string,and the rest of bits 45 of the symbol bit string 40 correspond to asuffix bit string.

How many bits of the symbol bit string 40 are encoded in arithmeticencoding as the prefix bit string through the context modeling and howmany bits of the symbol bit string 40 are encoded in arithmetic encodingas the suffix bit string in the bypass mode may be determined accordingto a size of a block or a size of a set of blocks. For example,regarding a 64×64 block, arithmetic encoding may be performed only on afirst bit from among bit strings of an intra prediction mode, andarithmetic encoding may be performed on the rest of bits in a bypassmode. Regarding blocks having other sizes, arithmetic encoding may beperformed on all bits of the bit strings of the intra prediction mode inthe bypass mode.

In general, information about bits close to a least significant bit(LSB) is relatively less important than information about bits close toa most significant bit (MSB) of a symbol bit string. Accordingly, thevideo encoding apparatus 10 and the video decoding apparatus 20 mayselect an arithmetic encoding method according to a binarization methodhaving a relatively high accuracy with respect to the prefix bit stringclose to the MSB even though there is a burden of an operation amount,and may select an arithmetic encoding method according to a binarizationmethod capable of performing a simple operation with respect to thesuffix bit string close to the LSB. Also, the video encoding apparatus10 and the video decoding apparatus 20 may select an arithmetic encodingmethod based on context modeling with respect to the prefix bit stringand may select an arithmetic encoding method, not performing contextmodeling, with respect to the suffix bit string close to the LSB.

In the above description, the exemplary embodiment in which binarizationis performed on the prefix bit string and the suffix bit string of thefinal coefficient position information of the transformation coefficientby using different methods has been described with reference to FIG. 3.Also, the exemplary embodiment in which arithmetic encoding is performedon the prefix bit string and the suffix bit string from among the bitstrings of the intra prediction mode by using different methods has beendescribed with reference to FIG. 4.

However, according to various exemplary embodiments, a symbol encodingmethod in which binarization and arithmetic encoding methodsindividually determined for the prefix bit string and the suffix bitstring are used or different binarization and arithmetic encodingmethods are used is not limited to the exemplary embodiments describedwith reference to FIGS. 3 and 4, and various binarization and arithmeticencoding methods may be used for various symbols.

FIG. 5 is a flowchart for describing a video encoding method, accordingto an exemplary embodiment.

In operation 51, symbols are generated by performing prediction andtransformation on image blocks.

In operation 53, a current symbol is classified into a prefix region anda suffix region based on a threshold value determined according to asize of a current block.

In operation 55, a prefix bit string and a suffix bit string aregenerated by using binarization methods individually determined for theprefix region and the suffix region of the symbol.

In operation 57, symbol encoding is performed by using arithmeticencoding methods individually determined for the prefix bit string andthe suffix bit string.

In operation 59, bit strings generated through the symbol encoding areoutput in the form of bitstreams.

In operation 57, the symbol encoding may be performed on the prefix bitstring by using an arithmetic encoding method for performing contextmodeling according to locations of bits, and the symbol encoding mayalso be performed on the suffix bit string by using an arithmeticencoding method for omitting the context modeling in a bypass mode.

In operation 57, when the symbol is final coefficient positioninformation of a transformation coefficient, the arithmetic encoding maybe performed by using a context of a predetermined index that ispreviously allocated to the locations of the bits of the prefix bitstring.

FIG. 6 is a flowchart for describing a video decoding method, accordingto an exemplary embodiment.

In operation 61, symbols of image blocks are parsed from a receivedbitstream.

In operation 63, a current symbol is classified into a prefix bit stringand a suffix bit string based on a threshold value determined accordingto a size of a current block.

In operation 65, arithmetic decoding is performed by using an arithmeticdecoding method determined for each of the prefix bit string and thesuffix bit string of the current symbol.

In operation 67, after the arithmetic decoding, inverse binarization isperformed by using a binarization method determined for each of theprefix bit string and the suffix bit string.

The prefix region and the suffix region of the symbol may be restored byperforming the inverse binarization by using the binarization methoddetermined for each of the prefix bit string and the suffix bit string.

In operation 69, the image blocks may be restored by performing inversetransformation and prediction on the current block by using the currentsymbol restored through the arithmetic decoding and the inversebinarization.

In operation 65, the arithmetic decoding for determining the contextmodeling according to the locations of the bits may be performed on theprefix bit string, and the arithmetic decoding for omitting the contextmodeling may be performed on the suffix bit string in a bypass mode.

In operation 65, when the symbol is the final coefficient positioninformation of the transformation coefficient, the arithmetic decodingmay be performed by using the context of the predetermined index that ispreviously allocated to the locations of the bits of the prefix bitstring.

In the video encoding apparatus 10 according to an exemplary embodimentand the video decoding apparatus 20 according to another exemplaryembodiment, blocks in which video data is split are split into codingunits having a tree structure, prediction units are used to performintra prediction on the coding units, and a transformation unit is usedto transform the coding units.

Hereinafter, a method and apparatus for encoding a video and a methodand apparatus for decoding a video based on a coding unit having a treestructure, a prediction unit, and a transformation unit will bedescribed.

FIG. 7 is a block diagram of a video encoding apparatus 100 based oncoding units having a tree structure, according to an exemplaryembodiment.

The video encoding apparatus 100 involving video prediction based on thecoding unit having a tree structure includes a maximum coding unitsplitter 110, a coding unit determiner 120, and an output unit 130(e.g., outputter). For convenience of description, the video encodingapparatus 100 involving video prediction based on the coding unit havinga tree structure will be referred to as a video encoding apparatus 100.

The maximum coding unit splitter 110 may split a current picture basedon a maximum coding unit for the current picture of an image. If thecurrent picture is larger than the maximum coding unit, image data ofthe current picture may be split into the at least one maximum codingunit. The maximum coding unit according to an exemplary embodiment maybe a data unit having a size of 32×32, 64×64, 128×128, 256×256, etc.,wherein a shape of the data unit is a square having a width and lengthin squares of 2. The image data may be output to the coding unitdeterminer 120 according to the at least one maximum coding unit.

A coding unit according to an exemplary embodiment may be characterizedby a maximum size and a depth. The depth denotes a number of times thecoding unit is spatially split from the maximum coding unit, and as thedepth deepens, deeper coding units according to depths may be split fromthe maximum coding unit to a minimum coding unit. A depth of the maximumcoding unit is an uppermost depth and a depth of the minimum coding unitis a lowermost depth. Since a size of a coding unit corresponding toeach depth decreases as the depth of the maximum coding unit deepens, acoding unit corresponding to an upper depth may include a plurality ofcoding units corresponding to lower depths.

As described above, the image data of the current picture is split intothe maximum coding units according to a maximum size of the coding unit,and each of the maximum coding units may include deeper coding unitsthat are split according to depths. Since the maximum coding unitaccording to an exemplary embodiment is split according to depths, theimage data of a spatial domain included in the maximum coding unit maybe hierarchically classified according to depths.

A maximum depth and a maximum size of a coding unit, which limit thetotal number of times a height and a width of the maximum coding unitare hierarchically split, may be predetermined.

The coding unit determiner 120 encodes at least one split regionobtained by splitting a region of the maximum coding unit according todepths, and determines a depth to output finally encoded image dataaccording to the at least one split region. In other words, the codingunit determiner 120 determines a coded depth by encoding the image datain the deeper coding units according to depths, according to the maximumcoding unit of the current picture, and selecting a depth having theleast encoding error. The determined coded depth and the encoded imagedata according to the determined coded depth are output to the outputunit 130.

The image data in the maximum coding unit is encoded based on the deepercoding units corresponding to at least one depth equal to or below themaximum depth, and results of encoding the image data are compared basedon each of the deeper coding units. A depth having the least encodingerror may be selected after comparing encoding errors of the deepercoding units. At least one coded depth may be selected for each maximumcoding unit.

The size of the maximum coding unit is split as a coding unit ishierarchically split according to depths, and as the number of codingunits increases. Also, even if coding units correspond to a same depthin one maximum coding unit, it is determined whether to split each ofthe coding units corresponding to the same depth to a lower depth bymeasuring an encoding error of the image data of the each coding unit,separately. Accordingly, even when image data is included in one maximumcoding unit, the image data is split into regions according to thedepths and the encoding errors may differ according to regions in theone maximum coding unit, and thus the coded depths may differ accordingto the regions in the image data. Thus, one or more coded depths may bedetermined in one maximum coding unit, and the image data of the maximumcoding unit may be divided according to coding units of at least onecoded depth.

Accordingly, the coding unit determiner 120 may determine coding unitshaving a tree structure included in the maximum coding unit. The ‘codingunits having a tree structure’ according to an exemplary embodimentinclude coding units corresponding to a depth determined to be the codeddepth, from among all deeper coding units included in the maximum codingunit. A coding unit of a coded depth may be hierarchically determinedaccording to depths in the same region of the maximum coding unit, andmay be independently determined in different regions. Similarly, a codeddepth in a current region may be independently determined from a codeddepth in another region.

A maximum depth according to an exemplary embodiment is an index relatedto the number of times splitting is performed from a maximum coding unitto a minimum coding unit. A first maximum depth according to anexemplary embodiment may denote the total number of times splitting isperformed from the maximum coding unit to the minimum coding unit. Asecond maximum depth according to an exemplary embodiment may denote thetotal number of depth levels from the maximum coding unit to the minimumcoding unit. For example, when a depth of the maximum coding unit is 0,a depth of a coding unit, in which the maximum coding unit is splitonce, may be set to 1, and a depth of a coding unit, in which themaximum coding unit is split twice, may be set to 2. Here, if theminimum coding unit is a coding unit in which the maximum coding unit issplit four times, 5 depth levels of depths 0, 1, 2, 3 and 4 exist, andthus the first maximum depth may be set to 4, and the second maximumdepth may be set to 5.

Prediction encoding and transformation may be performed according to themaximum coding unit. The prediction encoding and the transformation arealso performed based on the deeper coding units according to a depthequal to or depths less than the maximum depth, according to the maximumcoding unit.

Since the number of deeper coding units increases whenever the maximumcoding unit is split according to depths, encoding including theprediction encoding and the transformation is performed on all of thedeeper coding units which are generated as the depth deepens. Forconvenience of description, the prediction encoding and thetransformation will now be described based on a coding unit of a currentdepth, in a maximum coding unit.

The video encoding apparatus 100 may variously select a size or shape ofa data unit for encoding the image data. In order to encode the imagedata, operations, such as prediction encoding, transformation, andentropy encoding, are performed, and at this time, the same data unitmay be used for all operations or different data units may be used foreach operation.

For example, the video encoding apparatus 100 may select not only acoding unit for encoding the image data, but also a data unit differentfrom the coding unit so as to perform the prediction encoding on theimage data in the coding unit.

In order to perform prediction encoding in the maximum coding unit, theprediction encoding may be performed based on a coding unitcorresponding to a coded depth, e.g., based on a coding unit that is nolonger split to coding units corresponding to a lower depth.Hereinafter, the coding unit that is no longer split and becomes a basisunit for prediction encoding will now be referred to as a ‘predictionunit’. A partition obtained by splitting the prediction unit may includea prediction unit or a data unit obtained by splitting at least one of aheight and a width of the prediction unit. A partition is a data unithaving a shape in which the prediction unit of the coding unit isdivided, and the prediction unit may be a partition having the same sizeas the coding unit.

For example, when a coding unit of 2N×2N (where N is a positive integer)is no longer split and becomes a prediction unit of 2N×2N, a size of apartition may be 2N×2N, 2N×N, N×2N, or N×N. Examples of a partition typeinclude symmetrical partitions that are obtained by symmetricallysplitting a height or width of the prediction unit, partitions obtainedby asymmetrically splitting the height or width of the prediction unit,such as 1:n or n:1, partitions that are obtained by geometricallysplitting the prediction unit, and partitions having arbitrary shapes.

A prediction mode of the prediction unit may be at least one of an intramode, an inter mode, and a skip mode. For example, the intra mode or theinter mode may be performed on the partition of 2N×2N, 2N×N, N×2N, orN×N. Also, the skip mode may be performed only on the partition of2N×2N. The encoding is independently performed on one prediction unit ina coding unit, thereby selecting a prediction mode having a smallestencoding error.

The video encoding apparatus 100 may also perform the transformation onthe image data in a coding unit based not only on the coding unit forencoding the image data, but also based on a data unit that is differentfrom the coding unit. In order to perform the transformation in thecoding unit, the transformation may be performed based on atransformation unit having a size smaller than or equal to the codingunit. For example, the transformation unit may include a transformationunit for an intra mode and a transformation unit for an inter mode.

Similarly to the coding unit, the transformation unit in the coding unitmay be recursively split into smaller sized regions. Thus, residual datain the coding unit may be divided according to the transformation havinga tree structure according to transformation depths.

A transformation depth indicating the number of times splitting isperformed to reach the transformation unit by splitting the height andwidth of the coding unit may also be set in the transformation unit. Forexample, in a current coding unit of 2N×2N, a transformation depth maybe 0 when the size of a transformation unit is also 2N×2N, may be 1 whenthe transformation unit size is N×N, and may be 2 when thetransformation unit size is N/2×N/2. In other words, the transformationunit having a tree structure may be set according to transformationdepths.

Encoding information according to coding units corresponding to a codeddepth requires not only information about the coded depth, but alsoinformation related to prediction encoding and transformation.Accordingly, the coding unit determiner 120 not only determines a codeddepth having a smallest encoding error, but also determines a partitiontype in a prediction unit, a prediction mode according to predictionunits, and a size of a transformation unit for transformation.

Coding units according to a tree structure in a maximum coding unit anda method of determining a prediction unit and partition and atransformation unit, according to exemplary embodiments, will bedescribed in detail later with reference to FIGS. 7 through 19.

The coding unit determiner 120 may measure an encoding error of deepercoding units according to depths by using Rate-Distortion Optimizationbased on Lagrangian multipliers.

The output unit 130 outputs the image data of the maximum coding unit,which is encoded based on the at least one coded depth determined by thecoding unit determiner 120, and information about the encoding modeaccording to the coded depth, in bitstreams.

The encoded image data may be obtained by encoding residual data of animage.

The information about the encoding mode according to coded depth mayinclude information about the coded depth, the partition type in theprediction unit, the prediction mode, and the size of the transformationunit.

The information about the coded depth may be defined by using splitinformation according to depths, which indicates whether encoding isperformed on coding units of a lower depth instead of a current depth.If the current depth of the current coding unit is the coded depth,image data in the current coding unit is encoded and output, and thusthe split information may be defined not to split the current codingunit to a lower depth. Alternatively, if the current depth of thecurrent coding unit is not the coded depth, the encoding is performed onthe coding unit of the lower depth, and thus the split information maybe defined to split the current coding unit to obtain the coding unitsof the lower depth.

If the current depth is not the coded depth, encoding is performed onthe coding unit that is split into the coding unit of the lower depth.Since at least one coding unit of the lower depth exists in one codingunit of the current depth, the encoding is repeatedly performed on eachcoding unit of the lower depth, and thus the encoding may be recursivelyperformed for the coding units having the same depth.

Since the coding units having a tree structure are determined for onemaximum coding unit, and information about at least one encoding mode isdetermined for a coding unit of a coded depth, information about atleast one encoding mode may be determined for one maximum coding unit.Also, a coded depth of the image data of the maximum coding unit may bedifferent according to locations since the image data is hierarchicallysplit according to depths, and thus information about the coded depthand the encoding mode may be set for the image data.

Accordingly, the output unit 130 may assign encoding information about acorresponding coded depth and an encoding mode to at least one of thecoding unit, the prediction unit, and a minimum unit included in themaximum coding unit.

The minimum unit according to an exemplary embodiment is a rectangulardata unit obtained by splitting the minimum coding unit constituting thelowermost depth by 4. Alternatively, the minimum unit may be a maximumrectangular data unit that may be included in all of the coding units,prediction units, partition units, and transformation units included inthe maximum coding unit.

For example, the encoding information output through the output unit 130may be classified into encoding information according to coding units,and encoding information according to prediction units. The encodinginformation according to the coding units may include the informationabout the prediction mode and information about the size of thepartitions. The encoding information according to the prediction unitsmay include information about an estimated direction of an inter mode,information about a reference image index of the inter mode, informationabout a motion vector, information about a chroma component of an intramode, and information about an interpolation method of the intra mode.Also, information about a maximum size of the coding unit definedaccording to pictures, slices, or groups of pictures (GOPs), andinformation about a maximum depth may be inserted into a sequenceparameter set (SPS) or a picture parameter set (PPS).

Also, information about the maximum size of the transformation unitallowed for the current video and information about the minimum size ofthe transformation unit may be output via a header of a bitstream, anSPS, or a PPS. The output unit 130 may encode and output referenceinformation, single-direction prediction information, slice typeinformation including a fourth slice type, etc. related to theprediction described above with reference to FIGS. 1 to 6.

In the video encoding apparatus 100, the deeper coding unit may be acoding unit obtained by dividing a height or width of a coding unit ofan upper depth, which is one layer above, by two. In other words, whenthe size of the coding unit of the current depth is 2N×2N, the size ofthe coding unit of the lower depth is N×N. Also, the coding unit of thecurrent depth having the size of 2N×2N may include at most 4 codingunits of the lower depth.

Accordingly, the video encoding apparatus 100 may form the coding unitshaving the tree structure by determining coding units having an optimumshape and an optimum size for each maximum coding unit, based on thesize of the maximum coding unit and the maximum depth determinedconsidering characteristics of the current picture. Also, since encodingmay be performed on each maximum coding unit by using any one of variousprediction modes and transformations, an optimum encoding mode may bedetermined considering characteristics of the coding unit of variousimage sizes.

Thus, if an image having high resolution or a large data amount isencoded in a conventional macroblock, a number of macroblocks perpicture excessively increases. Accordingly, a number of pieces ofcompressed information generated for each macroblock increases, and thusit is difficult to transmit the compressed information and datacompression efficiency decreases. However, by using the video encodingapparatus 100, image compression efficiency may be increased since acoding unit is adjusted while considering characteristics of an imagewhile increasing a maximum size of a coding unit considering a size ofthe image.

The video encoding apparatus 100 of FIG. 7 may perform operations of thevideo encoding apparatus 10 described with reference to FIG. 1.

The coding unit determiner 120 may perform operations of the imageencoder 12 of the video encoding apparatus 10. The coding unitdeterminer 120 may determine a prediction unit for intra predictionaccording to coding units having a tree structure for each maximumcoding unit, perform the intra prediction in each prediction unit,determine a transformation unit for transformation, and performtransformation in each transformation unit.

The output unit 130 may perform operations of a symbol encoding unit 14and a bitstream output unit 16 of the video encoding apparatus 10.Symbols for various data units, such as a picture, a slice, a maximumcoding unit, a coding unit, a prediction unit, and a transformationunit, are generated, and each of the symbols is classified into a prefixregion and a suffix region according to a threshold value determinedbased on a size of the corresponding data unit. The output unit 130 maygenerate a prefix bit string and a suffix bit string by using abinarization method determined for each of the prefix region and thesuffix region of the symbol. Any one of a general binarization, a unarybinarization, a truncated unary binarization, an exponential golombbinarization, and a fixed length binarization is selected to binarizethe prefix region and the suffix region, thereby generating the prefixbit string and the suffix bit string.

The output unit 130 may perform symbol encoding by performing arithmeticencoding determined for each of the prefix bit string and the suffix bitstring. The output unit 130 may perform symbol encoding by performingarithmetic encoding for performing context modeling according tolocations of bits on the prefix bit string and by performing arithmeticencoding for omitting context modeling on the suffix bit string in abypass mode.

For example, when final coefficient position information of atransformation coefficient of the transformation unit is encoded, thethreshold value for classifying the prefix bit string and the suffix bitstring may be determined according to a size (width or height) of thetransformation unit. Alternatively, the threshold value may bedetermined according to sizes of a slice including the currenttransformation unit, a maximum coding unit, a coding unit, a predictionunit, etc.

Alternatively, it may be determined by a maximum index of an intraprediction mode how many bits of a symbol bit string are encoded inarithmetic encoding as the prefix bit string through context modeling inthe intra prediction mode and how many bits of the symbol bit string areencoded in arithmetic encoding as the suffix bit string in a bypassmode. For example, a total of 34 intra prediction modes may be used forprediction units having sizes of 8×8, 16×16, and 32×32, a total of 17intra prediction modes may be used for a prediction unit having a sizeof 4×4, and a total of another number of intra prediction modes may beused for a prediction unit having a size of 64×64. In this case, sincethe prediction units capable of using the same number of intraprediction modes are regarded as having similar statisticalcharacteristics, a first bit from among bit strings in the intraprediction mode may be encoded through the context modeling forarithmetic encoding with respect to the prediction units having sizes of8×8, 16×16, and 32×32. Also, all bits from among the bit strings in theintra prediction mode may be encoded in the bypass mode for arithmeticencoding with respect to the rest of the prediction units, that is, theprediction units having sizes of 4×4 and 64×64.

The output unit 130 may output the bit strings generated through thesymbol encoding in the form of bitstreams.

FIG. 8 is a block diagram of a video decoding apparatus 200 based on acoding unit having a tree structure, according to an exemplaryembodiment.

The video decoding apparatus 200 performing video prediction based onthe coding unit having a tree structure includes a receiver 210, animage data and encoding information extractor 220, and an image datadecoder 230.

Definitions of various terms, such as a coding unit, a depth, aprediction unit, a transformation unit, and information about variousencoding modes, for various operations of the video decoding apparatus200, may be identical to those described with reference to FIG. 7 andthe video encoding apparatus 100.

The receiver 210 receives and parses a bitstream of an encoded video.The image data and encoding information extractor 220 extracts encodedimage data for each coding unit from the parsed bitstream, wherein thecoding units have a tree structure according to each maximum codingunit, and outputs the extracted image data to the image data decoder230. The image data and encoding information extractor 220 may extractinformation about a maximum size of a coding unit of a current picturefrom various sources, for example, a header of the current picture, anSPS, or a PPS.

Also, the image data and encoding information extractor 220 extractsinformation about a coded depth and an encoding mode for the codingunits having a tree structure according to each maximum coding unit,from the parsed bitstream. The extracted information about the codeddepth and the encoding mode is output to the image data decoder 230. Inother words, the image data in a bit string is split into the maximumcoding unit so that the image data decoder 230 decodes the image datafor each maximum coding unit.

The information about the coded depth and the encoding mode according tothe maximum coding unit may be set for information about at least onecoding unit corresponding to the coded depth, and information about anencoding mode may include information about a partition type of acorresponding coding unit corresponding to the coded depth, a predictionmode, and a size of a transformation unit. Also, splitting informationaccording to depths may be extracted as the information about the codeddepth.

The information about the coded depth and the encoding mode according toeach maximum coding unit extracted by the image data and encodinginformation extractor 220 is information about a coded depth and anencoding mode determined to generate a minimum encoding error when anencoder, such as the video encoding apparatus 100, repeatedly performsencoding for each deeper coding unit according to depths according toeach maximum coding unit. Accordingly, the video decoding apparatus 200may restore an image by decoding the image data according to a codeddepth and an encoding mode that generates the minimum encoding error.

Since encoding information about the coded depth and the encoding modemay be assigned to a predetermined data unit from among a correspondingcoding unit, a prediction unit, and a minimum unit, the image data andencoding information extractor 220 may extract the information about thecoded depth and the encoding mode according to the predetermined dataunits. The predetermined data units to which the same information aboutthe coded depth and the encoding mode is assigned may be inferred to bethe data units included in the same maximum coding unit.

The image data decoder 230 restores the current picture by decoding theimage data in each maximum coding unit based on the information aboutthe coded depth and the encoding mode according to the maximum codingunits. In other words, the image data decoder 230 may decode the encodedimage data based on the extracted information about the partition type,the prediction mode, and the transformation unit for each coding unitfrom among the coding units having the tree structure included in eachmaximum coding unit. A decoding process may include prediction includingintra prediction and motion compensation, and inverse transformation.

The image data decoder 230 may perform intra prediction or motioncompensation according to a partition and a prediction mode of eachcoding unit, based on the information about the partition type and theprediction mode of the prediction unit of the coding unit according tocoded depths.

Also, the image data decoder 230 may perform inverse transformationaccording to each transformation unit in the coding unit, based on theinformation about the transformation unit according to the coding unitshaving a tree structure, so as to perform the inverse transformationaccording to maximum coding units. A pixel value of a spatial domain inthe coding unit may be restored through the inverse transformation.

The image data decoder 230 may determine at least one coded depth of acurrent maximum coding unit by using split information according todepths. If the split information indicates that image data is no longersplit in the current depth, the current depth is a coded depth.Accordingly, the image data decoder 230 may decode encoded data of atleast one coding unit corresponding to each coded depth in the currentmaximum coding unit by using the information about the partition type ofthe prediction unit, the prediction mode, and the transformation unitsize for each coding unit corresponding to the coded depth, and outputthe image data of the current maximum coding unit.

In other words, data units containing the encoding information includingthe same split information may be gathered by observing the encodinginformation set assigned for the predetermined data unit from among thecoding unit, the prediction unit, and the minimum unit, and the gathereddata units may be considered to be one data unit to be decoded by theimage data decoder 230 in the same encoding mode. Decoding of thecurrent coding unit may be performed by obtaining information about theencoding mode for each coding unit determined in such a manner.

Also, the video decoding apparatus 200 of FIG. 8 may perform operationsof the video decoding apparatus 20 described above with reference toFIG. 2.

The receiver 210 and the image data and encoding information extractor220 may perform operations of the parser 22 and the symbol decoder 24 ofthe video decoding apparatus 20. The image data decoder 230 may performoperations of the symbol decoder 24 of the video decoding apparatus 20.

The receiver 210 receives a bitstream of an image, and the image dataand encoding information extractor 220 parses symbols of image blocksfrom the received bitstream.

The image data and encoding information extractor 220 may classify acurrent symbol into a prefix bit string and a suffix bit string based ona threshold value determined according to a size of a current block. Forexample, when the final coefficient position information of thetransformation coefficient of the transformation unit is decoded, thethreshold value for classifying the prefix bit string and the suffix bitstring may be determined according to a size (width or height) of thetransformation unit. Alternatively, the threshold value may bedetermined according to sizes of the slice including the currenttransformation unit, the maximum coding unit, the coding unit, theprediction unit, etc. Alternatively, it may be determined by the maximumindex of the intra prediction mode how many bits of the symbol bitstring are encoded in arithmetic encoding as the prefix bit stringthrough context modeling in the intra prediction mode and how many bitsof the symbol bit string are encoded in arithmetic encoding as thesuffix bit string in the bypass mode.

Arithmetic decoding is performed by using an arithmetic decoding methoddetermined for each of the prefix bit string and the suffix bit stringof the current symbol. Arithmetic decoding for determining the contextmodeling according to bit positions may be performed on the prefix bitstring, and arithmetic decoding for omitting the context modeling may beperformed on the suffix bit string by using the bypass mode.

After the arithmetic decoding, inverse binarization is performedaccording to a binarization method determined for each of the prefix bitstring and the suffix bit string. The prefix region and the suffixregion of the symbol may be restored by performing the inversebinarization according to the binarization method determined for each ofthe prefix bit string and the suffix bit string.

The image data decoder 230 may restore image blocks by performinginverse transformation and prediction on the current block by using thecurrent symbol restored through the arithmetic decoding and the inversebinarization.

Consequently, the video decoding apparatus 200 may obtain informationabout at least one coding unit that generates the minimum encoding errorwhen encoding is recursively performed for each maximum coding unit, andmay use the information to decode the current picture. In other words,the coding units having the tree structure determined to be the optimumcoding units in each maximum coding unit may be decoded.

Accordingly, even if image data has high resolution and a large amountof data, the image data may be efficiently decoded and restored by usinga size of a coding unit and an encoding mode, which are adaptivelydetermined according to characteristics of the image data, by usinginformation about an optimum encoding mode received from an encoder.

FIG. 9 is a conceptual diagram of coding units, according to anexemplary embodiment.

A size of a coding unit may be expressed in width×height, and may be64×64, 32×32, 16×16, and 8×8. A coding unit of 64×64 may be split intopartitions of 64×64, 64×32, 32×64, or 32×32, a coding unit of 32×32 maybe split into partitions of 32×32, 32×16, 16×32, or 16×16, a coding unitof 16×16 may be split into partitions of 16×16, 16×8, 8×16, or 8×8, anda coding unit of 8×8 may be split into partitions of 8×8, 8×4, 4×8, or4×4.

In video data 310, a resolution is 1920×1080, a maximum size of a codingunit is 64, and a maximum depth is 2. In video data 320, a resolution is1920×1080, a maximum size of a coding unit is 64, and a maximum depth is3. In video data 330, a resolution is 352×288, a maximum size of acoding unit is 16, and a maximum depth is 1. The maximum depth shown inFIG. 9 denotes a total number of splits from a maximum coding unit to aminimum decoding unit.

If a resolution is high or a data amount is large, a maximum size of acoding unit may be large so as to not only increase encoding efficiencybut also to accurately reflect characteristics of an image. Accordingly,the maximum size of the coding unit of the video data 310 and 320 havinga higher resolution than the video data 330 may be 64.

Since the maximum depth of the video data 310 is 2, coding units 315 ofthe video data 310 may include a maximum coding unit having a long axissize of 64, and coding units having long axis sizes of 32 and 16 sincedepths are deepened to two layers by splitting the maximum coding unittwice. Meanwhile, since the maximum depth of the video data 330 is 1,coding units 335 of the video data 330 may include a maximum coding unithaving a long axis size of 16, and coding units having a long axis sizeof 8 since depths are deepened to one layer by splitting the maximumcoding unit once.

Since the maximum depth of the video data 320 is 3, coding units 325 ofthe video data 320 may include a maximum coding unit having a long axissize of 64, and coding units having long axis sizes of 32, 16, and 8since the depths are deepened to 3 layers by splitting the maximumcoding unit three times. As a depth deepens, detailed information may bemore precisely expressed.

FIG. 10 is a block diagram of an image encoder 400 based on codingunits, according to an exemplary embodiment.

The image encoder 400 performs operations of the coding unit determiner120 of the video encoding apparatus 100 to encode image data. In otherwords, an intra predictor 410 performs intra prediction on coding unitsin an intra mode, from among a current frame 405, and a motion estimator420 and a motion compensator 425 perform inter estimation and motioncompensation on coding units in an inter mode from among the currentframe 405 by using the current frame 405, and a reference frame 495.

Data output from the intra predictor 410, the motion estimator 420, andthe motion compensator 425 is output as a quantized transformationcoefficient through a transformer 430 and a quantizer 440. The quantizedtransformation coefficient is restored as data in a spatial domainthrough an inverse quantizer 460 and an inverse transformer 470, and therestored data in the spatial domain is output as the reference frame 495after being post-processed through a deblocking unit 480 (e.g.,deblocker) and a loop filtering unit 490 (e.g., loop filter). Thequantized transformation coefficient may be output as a bitstream 455through an entropy encoder 450.

In order for the image encoder 400 to be implemented in the videoencoding apparatus 100, each of the elements of the image encoder 400,e.g., the intra predictor 410, the motion estimator 420, the motioncompensator 425, the transformer 430, the quantizer 440, the entropyencoder 450, the inverse quantizer 460, the inverse transformer 470, thedeblocking unit 480, and the loop filtering unit 490 perform operationsbased on each coding unit from among coding units having a treestructure while considering the maximum depth of each maximum codingunit.

Specifically, the intra predictor 410, the motion estimator 420, and themotion compensator 425 determine partitions and a prediction mode ofeach coding unit from among the coding units having a tree structurewhile considering the maximum size and the maximum depth of a currentmaximum coding unit, and the transformer 430 determines thetransformation unit size in each coding unit from among the coding unitshaving a tree structure.

In particular, the entropy encoder 450 may perform symbol encoding onthe prefix region and the suffix region by classifying a symbol into theprefix region and the suffix region according to a predeterminedthreshold value and using different binarization and arithmetic encodingmethods with respect to the prefix region and the suffix region.

The threshold value for classifying the symbol into the prefix regionand the suffix region may be determined based on sizes of data units ofthe symbol, for example, a slice, a maximum coding unit, a coding unit,a prediction unit, a transformation unit, etc.

FIG. 11 is a block diagram of an image decoder 500 based on codingunits, according to an exemplary embodiment.

A parser 510 parses encoded image data to be decoded and informationabout encoding required for decoding from a bitstream 505. The encodedimage data is output as inverse quantized data through an entropydecoder 520 and an inverse quantizer 530, and the inverse quantized datais restored to image data in a spatial domain through an inversetransformer 540.

An intra predictor 550 performs intra prediction on coding units in anintra mode with respect to the image data in the spatial domain, and amotion compensator 560 performs motion compensation on coding units inan inter mode by using a reference frame 585.

The image data in the spatial domain, which passed through the intrapredictor 550 and the motion compensator 560, may be output as arestored frame 595 after being post-processed through a deblocking unit570 (e.g., deblocker) and a loop filtering unit 580 (e.g., loop filter).Also, the image data that is post-processed through the deblocking unit570 and the loop filtering unit 580 may be output as the reference frame585.

In order to decode the image data in the image data decoder 230 of thevideo decoding apparatus 200, the image decoder 500 may performoperations that are performed after the parsing performed by the parser510.

In order for the image decoder 500 to be implemented in the videodecoding apparatus 200, each of the elements of the image decoder 500,e.g., the parser 510, the entropy decoder 520, the inverse quantizer530, the inverse transformer 540, the intra predictor 550, the motioncompensator 560, the deblocking unit 570, and the loop filtering unit580 perform operations based on coding units having a tree structure foreach maximum coding unit.

Specifically, the intra predictor 550 and the motion compensator 560perform operations based on partitions and a prediction mode for each ofthe coding units having a tree structure, and the inverse transformer540 perform operations based on a size of a transformation unit for eachcoding unit.

In particular, the entropy decoder 520 may perform symbol decoding foreach of a prefix bit string and a suffix bit string by classifying theparsed symbol bit string into the prefix bit string and the suffix bitstring according to a predetermined threshold value and using differentbinarization and arithmetic decoding methods with respect to the prefixbit string and the suffix bit string.

The threshold value for classifying the symbol bit string into theprefix bit string and the suffix bit string may be determined based onsizes of data units of the symbol, for example, a slice, a maximumcoding unit, a coding unit, a prediction unit, a transformation unit,etc.

FIG. 12 is a diagram showing deeper coding units according to depths andpartitions, according to an exemplary embodiment.

The video encoding apparatus 100 and the video decoding apparatus 200use hierarchical coding units so as to consider characteristics of animage. A maximum height, a maximum width, and a maximum depth of codingunits may be adaptively determined according to the characteristics ofthe image, or may be differently set by a user. Sizes of deeper codingunits according to depths may be determined according to thepredetermined maximum size of the coding unit.

In a hierarchical structure 600 of coding units, according to anexemplary embodiment, the maximum height and the maximum width of thecoding units are each 64, and the maximum depth is 3. Here, the maximumdepth denotes a total number of times splitting is performed from themaximum coding unit to the minimum coding unit. Since a depth deepensalong a vertical axis of the hierarchical structure 600, a height and awidth of the deeper coding units are each split. Also, a prediction unitand partitions, which are bases for prediction encoding of each deepercoding unit, are shown along a horizontal axis of the hierarchicalstructure 600.

In other words, a coding unit 610 is a maximum coding unit in thehierarchical structure 600, wherein a depth is 0 and a size, e.g., aheight by width, is 64×64. The depth deepens along the vertical axis,and a coding unit 620 having a size of 32×32 and a depth of 1, a codingunit 630 having a size of 16×16 and a depth of 2, and a coding unit 640having a size of 8×8 and a depth of 3 are provided. A coding unit 640having the size of 8×8 and the depth of 3 is a minimum coding unit.

The prediction unit and the partitions of a coding unit are arrangedalong the horizontal axis according to each depth. In other words, ifthe coding unit 610 having the size of 64×64 and the depth of 0 is aprediction unit, the prediction unit may be split into partitionsincluded in the encoding unit 610, e.g., a partition 610 having a sizeof 64×64, partitions 612 having the size of 64×32, partitions 614 havingthe size of 32×64, or partitions 616 having the size of 32×32.

Similarly, a prediction unit of the coding unit 620 having the size of32×32 and the depth of 1 may be split into partitions included in thecoding unit 620, e.g., a partition 620 having a size of 32×32,partitions 622 having a size of 32×16, partitions 624 having a size of16×32, and partitions 626 having a size of 16×16.

Similarly, a prediction unit of the coding unit 630 having the size of16×16 and the depth of 2 may be split into partitions included in thecoding unit 630, e.g., a partition having a size of 16×16 included inthe coding unit 630, partitions 632 having a size of 16×8, partitions634 having a size of 8×16, and partitions 636 having a size of 8×8.

Similarly, a prediction unit of the coding unit 640 having the size of8×8 and the depth of 3 may be split into partitions included in thecoding unit 640, e.g., a partition having a size of 8×8 included in thecoding unit 640, partitions 642 having a size of 8×4, partitions 644having a size of 4×8, and partitions 646 having a size of 4×4.

In order to determine the at least one coded depth of the coding unitsconstituting the maximum coding unit 610, the coding unit determiner 120of the video encoding apparatus 100 performs encoding for coding unitscorresponding to each depth included in the maximum coding unit 610.

A number of deeper coding units classified according to depths includingdata in the same range and the same size increases as the depth deepens.For example, four coding units corresponding to a depth of 2 arerequired to cover data that is included in one coding unit correspondingto a depth of 1. Accordingly, in order to compare encoding results ofthe same data according to depths, the coding unit corresponding to thedepth of 1 and four coding units corresponding to the depth of 2 areeach encoded.

In order to perform encoding for a current depth from among the depths,a minimum encoding error may be selected for the current depth byperforming encoding for each prediction unit in the coding unitscorresponding to the current depth, along the horizontal axis of thehierarchical structure 600. Alternatively, the minimum encoding errormay be searched for by comparing the smallest encoding errors accordingto depths, by performing encoding for each depth as the depth deepensalong the vertical axis of the hierarchical structure 600. A depth and apartition having the minimum encoding error in the coding unit 610 maybe selected as the coded depth and a partition type of the coding unit610.

FIG. 13 is a diagram for describing a relationship between a coding unitand transformation units, according to an exemplary embodiment.

The video encoding or decoding apparatus (e.g., 100 or 200) encodes ordecodes an image according to coding units having sizes smaller than orequal to a maximum coding unit for each maximum coding unit. Sizes oftransformation units for transformation during encoding may be selectedbased on data units that are not larger than a corresponding codingunit.

For example, in the video encoding or decoding apparatus (e.g., 100 or200), if a size of the coding unit 710 is 64×64, transformation may beperformed by using the transformation units 720 having a size of 32×32.

Also, data of the coding unit 710 having the size of 64×64 may beencoded by performing the transformation on each of the transformationunits having the size of 32×32, 16×16, 8×8, and 4×4, which are smallerthan 64×64, and then a transformation unit having the least coding errormay be selected.

FIG. 14 is a diagram for describing encoding information of coding unitsaccording to depths, according to an exemplary embodiment.

The output unit 130 of the video encoding apparatus 100 may encode andtransmit information 800 about a partition type, information 810 about aprediction mode, and information 820 about a size of a transformationunit for each coding unit corresponding to a coded depth, as informationabout an encoding mode.

The information 800 indicates information about a shape of a partitionobtained by splitting a prediction unit of a current coding unit,wherein the partition is a data unit for prediction encoding the currentcoding unit. For example, a current coding unit CU_0 having a size of2N×2N may be split into any one of a partition 802 having a size of2N×2N, a partition 804 having a size of 2N×N, a partition 806 having asize of N×2N, and a partition 808 having a size of N×N. Here, theinformation 800 about a partition type is set to indicate one of thepartition 804 having a size of 2N×N, the partition 806 having a size ofN×2N, and the partition 808 having a size of N×N.

The information 810 indicates a prediction mode of each partition. Forexample, the information 810 may indicate a mode of prediction encodingperformed on a partition indicated by the information 800, e.g., anintra mode 812, an inter mode 814, or a skip mode 816.

The information 820 indicates a transformation unit to be based on whentransformation is performed on a current coding unit. For example, thetransformation unit may be a first intra transformation unit 822, asecond intra transformation unit 824, a first inter transformation unit826, or a second inter transformation unit 828.

The image data and encoding information extractor 220 of the videodecoding apparatus 200 may extract and use the information 800, 810, and820 for decoding, according to each deeper coding unit.

FIG. 15 is a diagram showing deeper coding units according to depths,according to an exemplary embodiment.

Split information may be used to indicate a change of a depth. The spiltinformation indicates whether a coding unit of a current depth is splitinto coding units of a lower depth.

A prediction unit 910 for prediction encoding a coding unit 900 having adepth of 0 and a size of 2N_0×2N_0 may include partitions of a partitiontype 912 having a size of 2N_0×2N_0, a partition type 914 having a sizeof 2N_0×N_0, a partition type 916 having a size of N_0×2N_0, and apartition type 918 having a size of N_0×N_0. FIG. 15 only illustratesthe partition types 912 through 918 which are obtained by symmetricallysplitting the prediction unit 910, but a partition type is not limitedthereto, and the partitions of the prediction unit 910 may includeasymmetrical partitions, partitions having a predetermined shape, andpartitions having a geometrical shape.

Prediction encoding is repeatedly performed on one partition having asize of 2N_0×2N_0, two partitions having a size of 2N_0×N_0, twopartitions having a size of N_0×2N_0, and four partitions having a sizeof N_0×N_0, according to each partition type. The prediction encoding inan intra mode and an inter mode may be performed on the partitionshaving the sizes of 2N_0×2N_0, N_0×2N_0, 2N_0×N_0, and N_0×N_0. Theprediction encoding in a skip mode is performed only on the partitionhaving the size of 2N_0×2N_0.

Errors of encoding including the prediction encoding in the partitiontypes 912 through 918 are compared, and the minimal encoding error isdetermined among the partition types. If an encoding error is smallestin one of the partition types 912 through 916, the prediction unit 910may not be split into a lower depth.

If the encoding error is the smallest in the partition type 918, a depthis changed from 0 to 1 to split the partition type 918 in operation 920,and encoding is repeatedly performed on coding units 930 having a depthof 2 and a size of N_0×N_0 to search for a minimum encoding error.

A prediction unit 940 for prediction encoding the coding unit 930 havinga depth of 1 and a size of 2N_1×2N_1 (=N_0×N_0) may include partitionsof a partition type 942 having a size of 2N_1×2N_1, a partition type 944having a size of 2N_1×N_1, a partition type 946 having a size ofN_1×2N_1, and a partition type 948 having a size of N_1×N_1.

If an encoding error is the smallest in the partition type 948, a depthis changed from 1 to 2 to split the partition type 948 in operation 950,and encoding is repeatedly performed on coding units 960, which have adepth of 2 and a size of N_2×N_2 to search for a minimum encoding error.

When a maximum depth is d, the coding unit according to each depth maybe performed up to when a depth becomes d−1, and split information maybe encoded up to when a depth is one of 0 to d−2. In other words, whenencoding is performed up to when the depth is d−1 after a coding unitcorresponding to a depth of d−2 is split in operation 970, a predictionunit 990 for prediction encoding a coding unit 980 having a depth of d−1and a size of 2N_(d−1)×2N_(d−1) may include partitions of a partitiontype 992 having a size of 2N_(d−1)×2N_(d−1), a partition type 994 havinga size of 2N_(d−1)×N_(d−1), a partition type 996 having a size ofN_(d−1)×2N_(d−1), and a partition type 998 having a size ofN_(d−1)×N_(d−1).

Prediction encoding may be repeatedly performed on one partition havinga size of 2N_(d−1)×2N_(d−1), two partitions having a size of2N_(d−1)×N_(d−1), two partitions having a size of N_(d−1)×2N_(d−1), andfour partitions having a size of N_(d−1)×N_(d−1) from among thepartition types 992 through 998 to search for a partition type having aminimum encoding error.

Even when the partition type 998 has the minimum encoding error, since amaximum depth is d, a coding unit CU_(d−1) having a depth of d−1 is nolonger split to a lower depth, and a coded depth for the coding unitsconstituting a current maximum coding unit 900 is determined to be d−1and a partition type of the current maximum coding unit 900 may bedetermined to be N_(d−1)×N_(d−1). Also, since the maximum depth is d anda minimum coding unit 980 having a lowermost depth of d−1 is no longersplit to a lower depth, split information for the minimum coding unit980 is not set.

A data unit 999 may be a ‘minimum unit’ for the current maximum codingunit. A minimum unit according to an exemplary embodiment may be arectangular data unit obtained by splitting a minimum coding unit 980 by4. By performing the encoding repeatedly, the video encoding apparatus100 may select a depth having the least encoding error by comparingencoding errors according to depths of the coding unit 900 to determinea coded depth, and set a corresponding partition type and a predictionmode as an encoding mode of the coded depth.

As such, the minimum encoding errors according to depths are compared inall of the depths of 1 through d, and a depth having the least encodingerror may be determined as a coded depth. The coded depth, the partitiontype of the prediction unit, and the prediction mode may be encoded andtransmitted as information about an encoding mode. Also, since a codingunit is split from a depth of 0 to a coded depth, only split informationof the coded depth is set to 0, and split information of depthsexcluding the coded depth is set to 1.

The image data and encoding information extractor 220 of the videodecoding apparatus 200 may extract and use the information about thecoded depth and the prediction unit of the coding unit 900 to decode thepartition 912. The video decoding apparatus 200 may determine a depth,in which split information is 0, as a coded depth by using splitinformation according to depths, and use information about an encodingmode of the corresponding depth for decoding.

FIGS. 16 to 18 are diagrams for describing a relationship between codingunits, prediction units, and transformation units, according to anexemplary embodiment.

The coding units 1010 are coding units having a tree structure,corresponding to coded depths determined by the video encoding apparatus100, in a maximum coding unit. The prediction units 1060 are partitionsof prediction units of each of the coding units 1010, and thetransformation units 1070 are transformation units of each of the codingunits 1010.

When a depth of a maximum coding unit is 0 in the coding units 1010,depths of coding units 1012 and 1054 are 1, depths of coding units 1014,1016, 1018, 1028, 1050, and 1052 are 2, depths of coding units 1020,1022, 1024, 1026, 1030, 1032, and 1048 are 3, and depths of coding units1040, 1042, 1044, and 1046 are 4.

In the prediction units 1060, some encoding units 1014, 1016, 1022,1032, 1048, 1050, 1052, and 1054 are obtained by splitting the codingunits in the encoding units 1010. In other words, partition types in thecoding units 1014, 1022, 1050, and 1054 have a size of 2N×N, partitiontypes in the coding units 1016, 1048, and 1052 have a size of N×2N, anda partition type of the coding unit 1032 has a size of N×N. Predictionunits and partitions of the coding units 1010 are smaller than or equalto each coding unit.

Transformation or inverse transformation is performed on image data ofthe coding unit 1052 in the transformation units 1070 in a data unitthat is smaller than the coding unit 1052. Also, the coding units 1014,1016, 1022, 1032, 1048, 1050, and 1052 in the transformation units 1070are different from those in the prediction units 1060 in terms of sizesand shapes. In other words, the video encoding and decoding apparatuses100 and 200 may perform intra prediction, motion estimation, motioncompensation, transformation, and inverse transformation individually ona data unit in the same coding unit.

Accordingly, encoding is recursively performed on each of coding unitshaving a hierarchical structure in each region of a maximum coding unitto determine an optimum coding unit, and thus coding units having arecursive tree structure may be obtained. Encoding information mayinclude split information about a coding unit, information about apartition type, information about a prediction mode, and informationabout a size of a transformation unit. Table 1 shows the encodinginformation that may be set by the video encoding and decodingapparatuses 100 and 200.

TABLE 1 Split Information 0 Split (Encoding on Coding Unit having Sizeof 2N × 2N and Current Depth of d) Information 1 Prediction PartitionType Size of Transformation Unit Repeatedly Mode Encode IntraSymmetrical Asymmetrical Split Split Coding Units Inter PartitionPartition Information 0 Information 1 having Lower Type Type of of Depthof d + 1 Transformation Transformation Unit Unit Skip 2N × 2N 2N × nU 2N× 2N N × N (Only 2N × N  2N × nD (Symmetrical 2N × 2N)  N × 2N nL × 2NType) N × N nR × 2N N/2 × N/2 (Asymmetrical Type)

The output unit 130 of the video encoding apparatus 100 may output theencoding information about the coding units having a tree structure, andthe image data and encoding information extractor 220 of the videodecoding apparatus 200 may extract the encoding information about thecoding units having a tree structure from a received bitstream.

Split information indicates whether a current coding unit is split intocoding units of a lower depth. If split information of a current depth dis 0, a depth, in which a current coding unit is no longer split into alower depth, is a coded depth, and thus information about a partitiontype, prediction mode, and a size of a transformation unit may bedefined for the coded depth. If the current coding unit is further splitaccording to the split information, encoding is independently performedon four split coding units of a lower depth.

A prediction mode may be one of an intra mode, an inter mode, and a skipmode. The intra mode and the inter mode may be defined in all partitiontypes, and the skip mode is defined only in a partition type having asize of 2N×2N.

The information about the partition type may indicate symmetricalpartition types having sizes of 2N×2N, 2N×N, N×2N, and N×N, which areobtained by symmetrically splitting a height or a width of a predictionunit, and asymmetrical partition types having sizes of 2N×nU, 2N×nD,nL×2N, and nR×2N, which are obtained by asymmetrically splitting theheight or width of the prediction unit. The asymmetrical partition typeshaving the sizes of 2N×nU and 2N×nD may be respectively obtained bysplitting the height of the prediction unit in 1:3 and 3:1, and theasymmetrical partition types having the sizes of nL×2N and nR×2N may berespectively obtained by splitting the width of the prediction unit in1:3 and 3:1.

The transformation unit size may be set to be two types in the intramode and two types in the inter mode. In other words, if splitinformation of the transformation unit is 0, the transformation unitsize may be 2N×2N, which is the size of the current coding unit. Ifsplit information of the transformation unit is 1, the transformationunits may be obtained by splitting the current coding unit. Also, if apartition type of the current coding unit having the size of 2N×2N is asymmetrical partition type, a size of a transformation unit may be N×N,and if the partition type of the current coding unit is an asymmetricalpartition type, the transformation unit size may be N/2×N/2.

The encoding information about coding units having a tree structure mayinclude at least one of a coding unit corresponding to a coded depth, aprediction unit, and a minimum unit. The coding unit corresponding tothe coded depth may include at least one of a prediction unit and aminimum unit containing the same encoding information.

Accordingly, it is determined whether adjacent data units are includedin the same coding unit corresponding to the coded depth by comparingencoding information of the adjacent data units. Also, a correspondingcoding unit corresponding to a coded depth is determined by usingencoding information of a data unit, and thus a distribution of codeddepths in a maximum coding unit may be determined.

Accordingly, if a current coding unit is predicted based on encodinginformation of adjacent data units, encoding information of data unitsin deeper coding units adjacent to the current coding unit may bedirectly referred to and used.

Alternatively, if a current coding unit is predicted based on encodinginformation of adjacent data units, data units adjacent to the currentcoding unit are searched using encoded information of the data units,and the searched adjacent coding units may be referred to for predictingthe current coding unit.

FIG. 19 is a diagram for describing a relationship between a codingunit, a prediction unit, and a transformation unit according to encodingmode information of Table 1.

A maximum coding unit 1300 includes coding units 1302, 1304, 1306, 1312,1314, 1316, and 1318 of coded depths. Here, since the coding unit 1318is a coding unit of a coded depth, split information may be set to 0.Information about a partition type of the coding unit 1318 having a sizeof 2N×2N may be set to be one of a partition type 1322 having a size of2N×2N, a partition type 1324 having a size of 2N×N, a partition type1326 having a size of N×2N, a partition type 1328 having a size of N×N,a partition type 1332 having a size of 2N×nU, a partition type 1334having a size of 2N×nD, a partition type 1336 having a size of nL×2N,and a partition type 1338 having a size of nR×2N.

Split information (TU size flag) of a transformation unit is a kind of atransformation index, and a transformation unit size corresponding tothe transformation index may vary according to a type of the predictionunit or the partition of the coding unit.

For example, when the partition type is set to be symmetrical, e.g., thepartition type 1322, 1324, 1326, or 1328, a transformation unit 1342having a size of 2N×2N is set if the split information of thetransformation unit is 0, and a transformation unit 1344 having a sizeof N×N is set if a TU size flag is 1.

When the partition type is set to be asymmetrical, e.g., the partitiontype 1332, 1334, 1336, or 1338, a transformation unit 1352 having a sizeof 2N×2N is set if a TU size flag is 0, and a transformation unit 1354having a size of N/2×N/2 is set if a TU size flag is 1.

Referring to FIG. 19, the TU size flag is a flag having a value of 0 or1, but the TU size flag is not limited to 1 bit, and a transformationunit may be hierarchically split having a tree structure while the TUsize flag increases from 0. The TU size flag may be used as an exemplaryembodiment of the transformation index.

In this case, if split information of the transformation unit is usedtogether with the maximum transformation unit size and the minimumtransformation unit size, the transformation unit size that is actuallyused may be expressed. The video encoding apparatus 100 may encodemaximum transformation unit size information, minimum transformationunit size information, and maximum transformation unit splitinformation. The encoded maximum transformation unit size information,minimum transformation unit size information, and maximum transformationunit split information may be inserted into an SPS. The video decodingapparatus 200 may perform video decoding by using the maximumtransformation unit size information, the minimum transformation unitsize information, and the maximum transformation unit split information.

For example, if a current coding unit has a size of 64×64 and themaximum transformation unit size is 32×32, when the transformation unitsplit information is 0, a transformation unit size may be set to 32×32,when the transformation unit split information is 1, the transformationunit size may be set to 16×16, and when the transformation unit splitinformation is 2, the transformation unit size may be set to 8×8.

Alternatively, if the current coding unit has a size of 32×32 and theminimum transformation unit size is 32×32, when the transformation unitsplit information is 1, the transformation unit size may be set to32×32, and since the transformation unit size is equal to or larger than32×32, no more transformation unit split information may be set.

Alternatively, if the current coding unit has a size of 64×64 and themaximum transformation unit split information is 1, the transformationunit split information may be set to 0 or 1, and other transformationunit split information may not be set.

Accordingly, if maximum transformation unit split information is definedas ‘MaxTransformSizeIndex’, if a minimum transformation unit size isdefined as ‘MinTransformSize’, and if a transformation unit size isdefined as ‘RootTuSize’ when the transformation unit split informationis 0, ‘CurrMinTuSize’ which is a minimum transformation unit sizeavailable in the current coding unit may be defined by formula (1)below:

$\begin{matrix}{{CurrMinTuSize} = {\max\left( {{MinTransformSize},{{RootTuSize}/\left( {2^{\bigwedge}{MaxTransformSizeIndex}} \right)}} \right)}} & {{FORMULA}\mspace{14mu} 1}\end{matrix}$

Compared to ‘CurrMinTuSize’ which is the minimum transformation unitsize available in the current coding unit, ‘RootTuSize’ which is atransformation unit size when the transformation unit split informationis 0 may represent a maximum transformation unit size that may beadopted in a system. In other words, according to formula (1),‘RootTuSize/(2{circumflex over ( )}MaxTransformSizeIndex)’ is atransformation unit size in which ‘RootTuSize’ is split a number oftimes corresponding to the maximum transformation unit split informationand ‘MinTransformSize’ is a minimum transformation unit size, and thus asmaller value from among ‘RootTuSize/(2{circumflex over( )}MaxTransformSizeIndex)’ and ‘MinTransformSize’ may be‘CurrMinTuSize’ which is the minimum transformation unit size availablein the current coding unit.

The ‘RootTuSize’ which is the maximum transformation unit size may varyaccording to a prediction mode.

For example, if a current prediction mode is an inter mode, the‘RootTuSize’ may be determined according to formula (2) below. Informula (2), ‘MaxTransformSize’ denotes a maximum transformation unitsize, and ‘PUSize’ denotes a current prediction unit size.RootTuSize=min(MaxTransformSize,PUSize)  FORMULA 2

In other words, if the current prediction mode is an inter mode, the‘RootTuSize’ which is a transformation unit size when the transformationunit split information is 0 may be set to a smaller value from among themaximum transformation unit size and the current prediction unit size.

If a prediction mode of a current partition unit is an intra mode, the‘RootTuSize’ may be determined according to formula (3) below.‘PartitionSize’ denotes a current partition unit size.RootTuSize=min(MaxTransformSize,PartitionSize)  FORMULA 3

In other words, if the current prediction mode is an intra mode, the‘RootTuSize’ may be set to a smaller value from among the maximumtransformation unit size and the current partition unit size.

However, the current maximum transformation unit size ‘RootTuSize’varying according to a prediction mode of the partition unit is just anexample, and a factor for determining the current maximum transformationunit size is not limited thereto.

Image data of a spatial domain is encoded for each coding unit having atree structure by using a video encoding method based on the codingunits having a tree structure described above with reference to FIGS. 7to 19, and decoding is performed on each maximum coding unit by using avideo decoding method based on the coding units having a tree structure,and thus the image data of the spatial domain is restored, therebyrestoring a video which is a picture and a picture sequence. Therestored video may be reproduced by a reproducing apparatus, may bestored in a storage medium, or may be transmitted via a network.

The exemplary embodiments may be written as computer programs and may beimplemented in general-use digital computers that execute the programsusing a computer readable recording medium. Examples of the computerreadable recording medium include magnetic storage media (e.g., ROM,floppy disks, hard disks, etc.) and optical recording media (e.g.,CD-ROMs, or DVDs).

While the disclosure has been particularly shown and described withreference to exemplary embodiments thereof, it will be understood bythose of ordinary skill in the art that various changes in form anddetails may be made therein without departing from the spirit and scopeof the exemplary embodiments as defined by the appended claims. Theexemplary embodiments should be considered in a descriptive sense onlyand not for purposes of limitation. Therefore, the scope of theexemplary embodiments is defined not by the detailed description of theexemplary embodiments but by the appended claims, and all differenceswithin the scope will be construed as being included in the exemplaryembodiments.

What is claimed is:
 1. An apparatus for decoding a video, the apparatuscomprising at least one processor configured to: obtain a prefixbitstring of a last coefficient location of a transformation block byperforming context-based arithmetic decoding on a received bitstream;when the prefix bitstring is greater than a predetermined value, obtain,from the bitstream, a suffix bitstring according to a bypass mode;perform inverse binarization on the prefix bitstring according to atruncated binarization scheme to obtain an inverse-binarized prefix;perform inverse binarization on the suffix bitstring according to afixed-length binarization scheme to obtain an inverse-binarized suffix;and reconstruct a symbol indicating the last coefficient location of thetransformation block by using the inverse-binarized prefix and theinverse-binarized suffix, wherein a range of a value of theinverse-binarized prefix is determined based on a size of thetransformation block and a range of a value of the inverse-binarizedsuffix is determined based on the value of the inverse-binarized prefix,wherein a value of the symbol indicating the last coefficient locationof the transformation block is reconstructed by using the value of theinverse-binarized prefix and the value of the inverse-binarized suffix,and wherein the context-based arithmetic decoding is performed by usinga context index determined based on the size of the transformation blockand a bin index of the prefix bitstring.